package com.crmweb.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.crmweb.entity.Askers;
import com.crmweb.entity.PageVo;
import com.crmweb.entity.Result;
import com.crmweb.entity.Userchecks;
import com.crmweb.service.AskersService;

@RestController
public class AskersController {

	@Resource
	private AskersService as;
	
	@RequestMapping("sysM/selAllAskers")
	public Map<String, Object> selAllAskers(HttpServletRequest request){
		
		String page = request.getParameter("page");
		String pageSize = request.getParameter("limit");
		PageVo vo = new PageVo();
		vo.setPage(Integer.parseInt(page));
		vo.setPageSize(Integer.parseInt(pageSize));
		
		Askers ask = new Askers();
		ask.setVo(vo);
		List<Askers> list = as.selAllAskers(ask);
		Map<String, Object> map = new HashMap<>();
		map.put("code", 0);
		map.put("data", list);
		map.put("count", as.getcount());
		
		return map;
		
	}
	//修改权重
	@RequestMapping("sysM/updAskersWeiht")
	public Object updAskersWeiht(Askers ask){
		
		int i = as.updAskersWeiht(ask);
		
		if(i>0) {
			Result res = new Result("修改权重成功","",true);
			return res;
		}else {
			Result res = new Result("修改权重失败","",false);
			return res;
		}
		
	}
}
